package com.zc.study.designPattern.创建型设计模式.prototypePattern.shallowClone;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 场景:公司周报需要员工提交周报,为提高效率,需要模版功能,特考虑此情况
 * 利用cloneable里面的clone方法实现浅复制
 */
public class Test {
    private static Logger logger = LoggerFactory.getLogger(Test.class);
    public static void main(String[] args) {
        WeeklyLog weeklyLog1 = new WeeklyLog();
        Attachment attachment = new Attachment();
        weeklyLog1.setAttachment(attachment);

        WeeklyLog weeklyLog2 = weeklyLog1.clone();
        logger.debug("提交周报是否是同一对象,{}",weeklyLog1 == weeklyLog2);
        logger.debug("包含附件是否是统一对象,{}",weeklyLog1.getAttachment() == weeklyLog2.getAttachment());

    }
}
